using System;
namespace RomanJendrusz.Amazon.ETL.Messages
{
    public abstract class AmazonRequest : IEquatable<AmazonRequest>
    {
        protected AmazonRequest()
        {
            correlationId = Guid.NewGuid();
        }

        private string merchantId = "All";
        private Guid correlationId;


        public Guid CorrelationId
        {
            get { return correlationId; }
            set { correlationId = value; }
        }

        public virtual string MerchantId
        {
            get { return merchantId; }
            set { merchantId = value; }
        }

        public abstract string ResponseGroup { get; }

        public abstract string Destination { get; }

        public bool Equals(AmazonRequest amazonRequest)
        {
            if (amazonRequest == null) return false;
            return Equals(merchantId, amazonRequest.merchantId) && Equals(correlationId, amazonRequest.correlationId);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(this, obj)) return true;
            return Equals(obj as AmazonRequest);
        }

        public override int GetHashCode()
        {
            return (merchantId != null ? merchantId.GetHashCode() : 0) + 29*correlationId.GetHashCode();
        }
    }
}